package com.ota.client.config;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * OTA客户端配置类
 */
public class OTAConfig {
    
    @JsonProperty("server")
    private ServerConfig server=new ServerConfig();
    
    @JsonProperty("device")
    private DeviceConfig device=new DeviceConfig();
    
    @JsonProperty("client")
    private ClientConfig client=new ClientConfig();
    
    public ServerConfig getServer() {
        return server;
    }
    
    public void setServer(ServerConfig server) {
        this.server = server;
    }
    
    public DeviceConfig getDevice() {
        return device;
    }
    
    public void setDevice(DeviceConfig device) {
        this.device = device;
    }
    
    public ClientConfig getClient() {
        return client;
    }
    
    public void setClient(ClientConfig client) {
        this.client = client;
    }
    
    /**
     * 服务器配置
     */
    public static class ServerConfig {
        @JsonProperty("url")
        private String url;
        
        public String getUrl() {
            return url;
        }
        
        public void setUrl(String url) {
            this.url = url;
        }
    }
    
    /**
     * 设备配置
     */
    public static class DeviceConfig {
        @JsonProperty("product_id")
        private String productId;
        
        @JsonProperty("sn")
        private String sn;
        
        @JsonProperty("version")
        private String version;
        
        @JsonProperty("key")
        private String key;
        
        public String getProductId() {
            return productId;
        }
        
        public void setProductId(String productId) {
            this.productId = productId;
        }
        
        public String getSn() {
            return sn;
        }
        
        public void setSn(String sn) {
            this.sn = sn;
        }
        
        public String getVersion() {
            return version;
        }
        
        public void setVersion(String version) {
            this.version = version;
        }
        
        public String getKey() {
            return key;
        }
        
        public void setKey(String key) {
            this.key = key;
        }
    }
    
    /**
     * 客户端配置
     */
    public static class ClientConfig {
        @JsonProperty("check_interval")
        private int checkInterval = 60; // 默认60秒
        
        @JsonProperty("download_timeout")
        private int downloadTimeout = 600; // 默认600秒
        
        @JsonProperty("temp_dir")
        private String tempDir = "/tmp/ota";
        
        public int getCheckInterval() {
            return checkInterval;
        }
        
        public void setCheckInterval(int checkInterval) {
            this.checkInterval = checkInterval;
        }
        
        public int getDownloadTimeout() {
            return downloadTimeout;
        }
        
        public void setDownloadTimeout(int downloadTimeout) {
            this.downloadTimeout = downloadTimeout;
        }
        
        public String getTempDir() {
            return tempDir;
        }
        
        public void setTempDir(String tempDir) {
            this.tempDir = tempDir;
        }
    }
} 